package top.lyc829.mymusic.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @Author lyc
 * @create 2021-07-04 13:23
 */
class ViewPager2Adapter(fragmentActivity: FragmentActivity, private val mFragments: List<Fragment>?) : FragmentStateAdapter(fragmentActivity) {

    override fun createFragment(position: Int): Fragment {
        return mFragments!![position]
    }

    override fun getItemCount(): Int {
        return mFragments?.size ?: 0
    }
}